package com.csxh.bookstore.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.csxh.bookstore.bean.Book;
import com.csxh.bookstore.dao.BookDao;

@Service
@Transactional
public class BookService {
    
	@Resource
	private BookDao bookDao;
	
	@Transactional(propagation=Propagation.SUPPORTS,readOnly=true)
	public List<Book> findAllWithOrderBy(String field,String mode) {
		Map<String, Object> params=new HashMap<String, Object>();
		params.put("orderBy", field+" "+mode);
		return bookDao.findAll(params);
	}
	
	
}
